from PyQt5.QtWidgets import QDialog, QVBoxLayout, QLineEdit, QHBoxLayout, QPushButton



class InputCaseInfoDialog(QDialog):
    """
    弹框提示输入case的feature,story
    """
    def __init__(self):
        super().__init__()
        self.setWindowTitle("输入用例信息")
        main_layout = QVBoxLayout()

        # 创建第一个输入框
        self.input_feature = QLineEdit(self)
        self.input_feature.setPlaceholderText("输入 feature")
        main_layout.addWidget(self.input_feature)
        # 创建第二个输入框
        self.input_story = QLineEdit(self)
        self.input_story.setPlaceholderText("输入 story")
        main_layout.addWidget(self.input_story)
        # 创建确定和取消按钮
        button_layout = QHBoxLayout()
        cancel_btn = QPushButton("取消", self)
        ok_btn = QPushButton("确定", self)
        ok_btn.setDefault(True)
        # 将按钮加入到按钮布局
        button_layout.addWidget(cancel_btn)
        button_layout.addWidget(ok_btn)

        # 按钮点击连接槽
        cancel_btn.clicked.connect(self.reject)
        ok_btn.clicked.connect(self.accept)

        # 将按钮布局加入到主布局
        main_layout.addLayout(button_layout)

        # 设置对话框的主布局
        self.setLayout(main_layout)

    def get_input_data(self):
        """ 获取输入框的内容 """
        return self.input_feature.text(), self.input_story.text()
